********************************************************************************
***
*** 	Replication files for Zhuang, Maiting. 2022.
***
*** 	"Intergovernmental Conflict and Censorship: Evidence from China's 
***
***		Anti-Corruption Campaign" 
***
***		Journal of the European Economic Association
***
********************************************************************************

*** 	Do-file for all Tables and Figures in Appendix D

clear

global dir "your directory path"
cd "$dir"

********************************************************************************

use "$dir/data/sinaweibo.dta",clear

preserve
duplicates drop np,force

estpost summarize np_partypaper np_nonpartygovt np_subsidiary np_central np_provincial np_subprovincial
esttab using "$dir/output/TableD1a1.tex", ///
	cells(" mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0)) count(fmt(0))") ///
	label fragment replace collabels(none) noobs nomtitle nonumber nolines booktabs
estpost summarize friends followers posts
esttab using "$dir/output/TableD1a2.tex", ///
	cells(" mean(fmt(%16.0fc)) sd(fmt(%16.0fc)) min(fmt(%16.0fc)) max(fmt(%16.0fc)) count(fmt(%16.0fc))") ///
	label fragment replace collabels(none) noobs nomtitle nonumber nolines booktabs
restore

***

preserve
duplicates drop mid,force

estpost summarize comment forward like
esttab using "$dir/output/TableD1b.tex", ///
	cells(" mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0)) count(fmt(0))") ///
	label fragment replace collabels(none) noobs nomtitle nonumber nolines booktabs
restore

********************************************************************************

use "$dir/data/sinaweibo_comments.dta",clear

estpost summarize c_u_followers c_u_friends c_u_posts
esttab using "$dir/output/TableD1c1.tex", ///
	cells(" mean(fmt(%16.0fc)) sd(fmt(%16.0fc)) min(fmt(0)) max(fmt(%16.0fc)) count(fmt(%16.0fc))") ///
	label fragment replace collabels(none) noobs nomtitle nonumber nolines booktabs
estpost summarize male verified  
esttab using "$dir/output/TableD1c2.tex", ///
	cells(" mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0)) count(fmt(%16.0fc))") ///
	label fragment replace collabels(none) noobs nomtitle nonumber nolines booktabs

********************************************************************************

*** FIGURE D.1

use "$dir/data/sinaweibo_comments.dta",clear
	
scatter count_comments comment,msize(small) || line comment comment, lcolor(black) lwidth(thin) ||,  scheme(s1mono) legend(off) ///
ytitle("Number of collected comments", margin(medium)) ///
xtitle("Number of total reported comments", margin(medium))
graph export "$dir/output/FigureD1.pdf",replace

